import React, { Component } from 'react'

const detailData = [
    {id: '01', content : '你好，中国'},
    {id: '02', content : '你好，日本'},
    {id: '03', content : '你好，美国'},
    {id: '04', content : '你好，韩国'},
    {id: '05', content : '你好，英国'},
]


export default class Detail extends Component {

  render() {
    
    // const{id,title} = this.props.match.params;
    //接受search参数
    // const {search} = this.props.location;
    // const {id,title} = qs.parse(search.slice(1));
    //接收state参数
    const {id,title} = this.props.location.state;

    const findResult = detailData.find(item => item.id === id)
    return (
      <ul>
        <li>ID:{id}</li>&nbsp;&nbsp;
        <li>Title:{title}</li>&nbsp;&nbsp;
        <li>Content:{findResult.content}</li>&nbsp;&nbsp;
      </ul>
    )
  }
}
